person_info = {
    "name": "Alex",
    "age": 30,
    "country": "USA",
    "language": ["English", "Spanish"],
    "is_student": False
}

#打印`person_info` 字典的`name` 值
# print(person_info["name"])

#修改`age` 的值为 31
# person_info["age"] = 31

#向字典中添加一个新的键值对 `height": 175`
# person_info["hight"] = 175

#删除字典中的 `is_student"` 键及其值
# del person_info["is_student"]

#使用循环遍历字典，打印所有的键和值
# for i in person_info.keys():
#     print(f"{i}:{person_info[i]}")

#检查字典中是否有 `email"` 这个键，如果没有，添加 `email": "alex@example.com"`。
# if 'email' not in person_info.keys():
#     person_info["email"] =  "alex@example.com"

#将`language` 的值改为只包含 `English"`
# person_info["language"] = "English"
# print(person_info["language"])

#获取并打印字典中`language` 列表的长度
# def person_infos(dict:dict,key:str):
#     print(dict[key],len(dict[key]))
# person_infos(person_info,'language')

#向`language` 列表中添加一种新语言 `French"
# person_info['language'].append('French')

#循环插入新的键值对到字典：将 ` hobby'` + 数字 作为键，相应的 ` hobby'` + 数字值 作为值，数字从1至3
# for i in range(1,4):
#     person_info[f'hobby{i}'] = f'hobby{i}'
# print(person_info)
